using System;
using System.Collections.Generic;

namespace PDiccionario
{
	public class MyDict
	{
		private List<KeyValuePair> dictionary;
		
		public MyDict()
		{
			dictionary=new List<KeyValuePair>();
		}
		
		public void Add(string key)
		{
			bool v=false;			
				foreach (KeyValuePair entry in dictionary)
				{
					if(entry.Key==key) {entry.Add(); v=true;}
				}
				if (v==false) dictionary.Add(new KeyValuePair(key));		
		}
		
		public void ShowAll()
		{
			foreach (KeyValuePair entry in dictionary)
			{
				Console.WriteLine(entry.Show());
			}
		}
	}
	


	internal class KeyValuePair
	{
		private string key;
		private long times;
		
		public KeyValuePair (string key) {
			this.key=key;
			times=1;
		}
		public void Add ()
		{
			times++;
		}
		public string Show()
		{
			string msg=String.Format("La palabra '{0}' está contenida {1} veces en el string",key,times);
			return msg;
		}
		public string Key {
			get {return key;}
		}
	}
	
}
